home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / filesyst / ncpfs / ipxripd-.000 / ipxripd- / ipxripd / ipxsap.h < prev    next >
C/C++ Source or Header  |  1996-02-01  |  3KB  |  96 lines

  1. /*
  2.  
  3.     IPX support library
  4.  
  5.     Copyright (C) 1994, 1995  Ales Dryak <e-mail: A.Dryak@sh.cvut.cz>
  6.     Copyright (C) 1996, Volker Lendecke <lendecke@namu01.gwdg.de>
  7.  
  8.     This program is free software; you can redistribute it and/or modify
  9.     it under the terms of the GNU General Public License as published by
  10.     the Free Software Foundation; either version 2 of the License, or
  11.     (at your option) any later version.
  12.  
  13.     This program is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.     GNU General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU General Public License
  19.     along with this program; if not, write to the Free Software
  20.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. */
  23. #ifndef __IPXSAP_H__
  24.  
  25. #define __IPXSAP_H__
  26.  
  27. #include <stdio.h>
  28. #include "ipxutil.h"
  29.  
  30. #define IPX_SAP_PORT        (0x452U)
  31. #define IPX_SAP_PTYPE        (4U)
  32. #define IPX_SAP_OP_REQUEST    (1U)
  33. #define IPX_SAP_GENERAL_RQ    (0xFFFFU)
  34. #define IPX_SAP_OP_RESPONSE    (2U)
  35. #define IPX_SAP_OP_GNS_REQUEST    (3U)
  36. #define IPX_SAP_OP_GNS_RESPONSE    (4U)
  37. #define IPX_SAP_MAX_ENTRIES    (7U)
  38. #define IPX_SAP_SERVER_DOWN    (16U)
  39. #define IPX_SAP_SERVER_NAME_LEN    (48U)
  40. #define IPX_SAP_REQUEST_LEN    (4U)
  41.  
  42. typedef unsigned short int ser_type_t;
  43. typedef char ser_name_t[IPX_SAP_SERVER_NAME_LEN];
  44.  
  45. struct sap_entry
  46. {
  47.     ser_type_t ser_type __attribute__ ((packed));
  48.     ser_name_t ser_name __attribute__ ((packed));
  49.     IPXNet network      __attribute__ ((packed));
  50.     IPXNode node        __attribute__ ((packed));
  51.     IPXPort port        __attribute__ ((packed));
  52.     hop_t hops          __attribute__ ((packed));
  53. };
  54.  
  55. struct sap_packet
  56. {
  57.     unsigned short int operation      __attribute__ ((packed));
  58.     struct sap_entry   sap_entries[IPX_SAP_MAX_ENTRIES]
  59.                                   __attribute__ ((packed));
  60. };
  61.  
  62. int ipx_sap_size(int n,unsigned short int operation);
  63. void ipx_sap_dump(struct sap_packet *pkt,int len);
  64. void ipx_sap_fdump(FILE *file,struct sap_packet *pkt,int len);
  65. void ipx_sap_assign_ser_name(ser_name_t dest,ser_name_t src); 
  66. void ipx_sap_fprint_name(FILE *file,ser_name_t sname);
  67. int ipx_sap_name_equal(ser_name_t n1,ser_name_t n2);
  68. int ipx_sap_type_equal(ser_type_t t1,ser_type_t t2);
  69.  
  70. struct sap_output
  71. {
  72.     struct sockaddr_ipx dest_addr;
  73.     int sk; /* the socket to send/receive on */
  74.     int send_error;
  75.     int entries;
  76.     struct sap_packet buffer;
  77. };
  78.  
  79. int ipx_sap_output_init(struct sap_output *out,IPXNet iface);
  80. void ipx_sap_output_flush(struct sap_output *out);
  81. void ipx_sap_output_request(struct sap_output *out,ser_type_t ser_type);
  82. void ipx_sap_output_gns_request(struct sap_output *out,ser_type_t ser_type);
  83. void ipx_sap_output_response(struct sap_output *out,ser_type_t type,
  84.                  ser_name_t name,struct sockaddr_ipx *addr,
  85.                  hop_t hops,int down_allow);
  86. void ipx_sap_output_gns_response(struct sap_output *out,ser_type_t type,
  87.                  ser_name_t name,struct sockaddr_ipx *addr,
  88.                  hop_t hops);
  89. void ipx_sap_output_set_destination(struct sap_output *out,IPXNode node,
  90.                     IPXPort port);
  91.  
  92. extern int (*ipx_sap_output_func)(int sock, void *buffer,int size,
  93.                    struct sockaddr_ipx *daddr);
  94.  
  95. #endif
  96.